<template>
    <div class="bank-table">
        <el-table style="width: 100%" :data="data">
            <el-table-column prop="companyName" label="公司名称" width="230"></el-table-column>
            <el-table-column prop="workJobName" label="职位名称"></el-table-column>
            <el-table-column label="自荐奖金">
                <template slot-scope="scope">
                    <span style="color:#f15c18">{{scope.row.selfBonus ? scope.row.selfBonus + 'K' : '---'}}</span>
                </template>
            </el-table-column>
            <el-table-column prop="successWorkTime" label="入职成功时间" width="170"></el-table-column>
            <el-table-column prop="guaranteed_period" label="保证期" width="80"></el-table-column>
            <el-table-column prop="bonusState" label="奖金状态" width="130">
                <template slot-scope="scope">
          <span
                  v-if="scope.row.bonusState == 0 || scope.row.bonusState == 1"
                  style="color:#f09338"
          >待发放</span>
                    <span v-else-if="scope.row.bonusState == 2" style="color:#409667">已发放</span>
                </template>
            </el-table-column>
            <el-table-column>
                <template slot-scope="scope">
                    <img
                            src="../../assets/img/chip.png"
                            alt
                            width="28px"
                            style="cursor: pointer;"
                            @click="doCommunication(scope.row.companyName,scope.row.workJobName,scope.row.platfromId,scope.row.id)"
                    >
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
  import _g from '../../assets/utils/global'

  export default {
    props: ['data'],
    data() {
      return {}
    },
    methods: {
      doCommunication(companyName, jobName, platformId, jobId) {
        const params = {
          state: 3,
          platformId: platformId,
          companyName: '',
          jobName: '',
          jobId: jobId
        }
        _g.apiPost('/talent/clickCommnicationButton.do', params)
          .then(res => {
            if (res && res.status === 0) {
              console.log('start communicate consultant success', params, res)
              this.$router.push({
                path: '/communication',
                query: { commId: res.data, companyName: companyName }
              })
            }
          })

      }
    },
    components: {}
  }
</script>

<style lang="scss" scoped>
</style>
